<template>
  <div>这是首页 - <button @click="fn">btn</button></div>
</template>

<script>
//  useRouter, useRoute是函数
// useRouter, useRoute只能在setup的顶层调用
import { useRouter } from "vue-router";
export default {
  setup() {
    const router = useRouter();
    // const route = useRoute();
    // console.log(router);  // this.$router
    // console.log(route); // this.$route

    const fn = () => {
      // const router = useRouter();
      router.push("/about");
    };

    return {
      fn,
    };
  },
};
</script>
